<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="../js/vue.js"></script>
		<script src="../js/axios.js"></script>
	</head>
	<body>
		<div id="a">
			<button @click="show()">点我</button>
			<p>{{msg}}</p>
			
		</div>
		<script type="text/javascript">
			new Vue({
				el:"#a",
				data(){
					return{
					msg:""						
					}
				},
				methods:{
					show(){
						let url = "http://localhost:8080/hello"
						axios.get(url)
						.then(promise=>{
							this.msg=promise.data
							console.log(promise.data)
						})
						
						let url1 = "http://localhost:8080/axios/getUserById?id=100"
						axios.get(url1)
						.then(promise => {
							this.msg = promise.data
							console.log(promise.data)
						})
						let user2 = {name:"jack",age:21}
						let url2 = "http://localhost:8080/axios/getUserByNA"
						axios.get(url2,{params:user2})
						.then(promise=>{
							this.msg = promise
							this.msg = promise.status
							if(promise.status === 200){
								this.msg = promise.data
							}else{
								this.msg = "业务失败"
							}
							
							
							
						})
						
						
					}
				}
			})
			
			
		</script>
		
		
	</body>
</html>
